<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</head>
<body>


<div id="app">
    <router-link to="/app">app</router-link>
    <router-link to="/demo">demo</router-link>

    <router-view></router-view>
</div>

<script>
    const app = {
        template:"<h1>这是h1</h1>"
    };
    const demo = {
        template:"<h2>这是h2</h2>"
    };
    const routes = [
        {
            path:"/app",
            component:app
        },
        {
            path:"/demo",
            component:demo
        }
    ];
    const router = new VueRouter({
        routes
    });

    let vm = new Vue({
        router
    }).$mount("#app")
</script>
</body>
</html>